// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   AuthHttpUtils.java

package dale.web.core.util;

import dale.web.user.model.User;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class AuthHttpUtils
{

    public AuthHttpUtils()
    {
    }

    public static boolean permits(HttpServletRequest request)
    {
        return hasOpenPath(request) || hasUserSession(request);
    }

    public static boolean hasOpenPath(HttpServletRequest request)
    {
        if(request == null)
        {
            return false;
        } else
        {
            String servletPath = request.getServletPath();
            return openPathList.contains(servletPath);
        }
    }

    public static boolean hasUserSession(HttpServletRequest request)
    {
        if(request == null)
            return false;
        HttpSession session = request.getSession(false);
        if(session == null)
            return false;
        User user = (User)session.getAttribute("user");
        return user != null;
    }

    private static List openPathList;

    static 
    {
        openPathList = new ArrayList();
        openPathList.add("/user/signIn");
    }
}
